// 实现vue   defineReactive

function defineReactive(obj, key, val) {
    objserve(val)
    Object.defineProperty(obj, key, {
        get() {
            console.log('get', val)
            return val
        },
        set(newVal) {
            if (newVal !== val) {
                objserve(newVal)
                newVal = val
            }
        }
    })
}


function objserve(obj) {
    if (obj instanceof 'Object' && obj !== null) {
        Object.keys(obj).forEach(key => {
            defineReactive(obj, key, obj[key])
        })
    }


}
function set(obj, key, val) {
    defineReactive(obj, key, val)
}